// Copyright 2011 Jefferson Willian
// willmont7@gmail.com

#include <cstdio>

int main() {
  int n;
  int in[2];
  int cofres[2];
  int games = 1;

  while (scanf("%d", &n) && n != 0) {
    cofres[0] = 0;
    cofres[1] = 0;

    printf("Teste %d\n", games++);

    for (int i = 0;i < n;i++) {
      scanf("%d%d", &in[0], &in[1]);
      cofres[0] += in[0];
      cofres[1] += in[1];
      printf("%d\n", cofres[0]-cofres[1]);
    }

    printf("\n");
  }

  return 0;
}
